//
//  SEGWinRecordOffLineCodeCell.m
//  ExcellentHome
//
//  Created by 揭婧雯 on 2017/8/22.
//  Copyright © 2017年 陈区. All rights reserved.
//

#import "SEGWinRecordOffLineCodeCell.h"

@interface SEGWinRecordOffLineCodeCell ()
/**
 内容
 */
@property (nonatomic, strong)UILabel *contentLabel;
@property (nonatomic, strong) UIImageView *invaildImageView;

@end

@implementation SEGWinRecordOffLineCodeCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self setupUI];
    }
    return self;
}

- (void)setupUI {
    self.backgroundColor = kColor_W;

    UILabel *inviteLabel = [[UILabel alloc] init];
    inviteLabel.font = kFont_13;
    inviteLabel.textColor = kColor_T;
    inviteLabel.backgroundColor = kColor_W;
    inviteLabel.text = @" 领取码 ";
    [self.contentView addSubview:inviteLabel];
    [inviteLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).offset(40);
        make.centerX.equalTo(self.contentView);
    }];
    
    UIView *line = [[UIView alloc] init];
    line.backgroundColor = kColor_W;
    line.layer.borderColor = kColor_T.CGColor;
    line.layer.borderWidth = 1;
    [self.contentView addSubview:line];
    [line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(inviteLabel.mas_centerY);
        make.centerX.equalTo(self.contentView);
        make.bottom.equalTo(self.contentView.mas_bottom).offset(-40);
        make.width.mas_equalTo(150);
        make.height.mas_equalTo(59);
    }];
    [self.contentView sendSubviewToBack:line];
    
    _contentLabel = [[UILabel alloc] init];
    _contentLabel.font = kFont_36;
    _contentLabel.textColor = kColor_T;
    [self.contentView addSubview:_contentLabel];
    [_contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(line);
        make.centerX.equalTo(line);
    }];
    
    _invaildImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:SEGPicName(@"img_failure")]];
    _invaildImageView.contentMode = UIViewContentModeCenter;
    _invaildImageView.hidden = YES;
    [self.contentView addSubview:_invaildImageView];
    [_invaildImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(_contentLabel);
        make.leading.mas_equalTo(line.mas_trailing).offset(-9);
        make.size.mas_equalTo(CGSizeMake(67, 67));
    }];
}

- (void)setUpCellWithAcceptNum:(NSString *)acceptNum {
    self.contentLabel.text = acceptNum;
}

- (void)showInvailState {
    _invaildImageView.hidden = NO;
}

@end
